//
//  NoAuthViewController.m
//  atXiaoGeBClient
//
//  Created by Linyu Niu on 20/04/2018.
//  Copyright © 2018 Linyu Niu. All rights reserved.
//

#import "NoAuthViewController.h"

@interface NoAuthViewController ()<UITableViewDelegate,UITableViewDataSource>
{
    UITableView * authTableView;
}
@end

@implementation NoAuthViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    __weak NoAuthViewController * weakSelf = self;
    UIView * navView = [[CTMediator sharedInstance] navgationHeadViewInTargetView:self.view params:[NSDictionary dictionaryWithObjectsAndKeys:@"没有开通派件权限",@"title", nil] leftAction:^(UIButton *sender){
        [weakSelf.navigationController popViewControllerAnimated:YES];
    } rightAction:nil];
    authTableView = [self addTableViewInView:self.view frame:CGRectMake(0, navView.frame.origin.y + navView.frame.size.height, self.view.frame.size.width, self.view.frame.size.height - (navView.frame.origin.y + navView.frame.size.height)) delegateAndDataSource:self];
    
    UIButton * questButton = [[CTMediator sharedInstance] commonOrangeButton:CGRectMake(30, self.view.frame.size.height - 60, self.view.frame.size.width - 60, 40) title:@"咨询客服" delegate:self action:@selector(questCustomer)];
    [self.view addSubview:questButton];
    
    UIButton * applyButton = [[CTMediator sharedInstance] commonOrangeButton:CGRectMake(questButton.frame.origin.x, questButton.frame.origin.y - questButton.frame.size.height - 15, questButton.frame.size.width , questButton.frame.size.height) title:@"申请开通" delegate:self action:@selector(apply)];
    [self.view addSubview:applyButton];
}
-(void)apply{
    
}
-(void)questCustomer{
    
}
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
    return 1;
}
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
    ElementTableViewCell * cell = [[ElementTableViewCell alloc]initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:nil];
    
    UILabel * failLabel = [[UILabel alloc]initWithFrame:CGRectMake(0, 100, tableView.frame.size.width, 30)];
    failLabel.textColor = UIColorFromRGB(0x333333);
    failLabel.font = [UIFont systemFontOfSize:23];
    failLabel.textAlignment = NSTextAlignmentCenter;
    failLabel.text = @"扫描失败";
    [cell addSubview:failLabel];
    
    
    UILabel * desLabel = [[UILabel alloc] init];
    desLabel.frame = CGRectMake(30, failLabel.frame.origin.y + failLabel.frame.size.height + 10, tableView.frame.size.width - 60, 30.7);
    
    
    [desLabel setLineSpacing:5.0 labelText:@"该账号未开通派件权限，开通后您每派送 一件网点的普通快递，大约可以获得2元 的派件费用，并且获得免费无限发送短信 的特权"];
    desLabel.font = [UIFont systemFontOfSize:15];
    desLabel.numberOfLines = 0;
    [desLabel enlargeHeightToKeepFontSize];
    desLabel.textColor = [UIColor colorWithRed:51.0/255.0 green:51.0/255.0 blue:51.0/255.0 alpha:1.0];
    [cell addSubview:desLabel];
    
    cell.cellHeight = desLabel.frame.size.height + desLabel.frame.origin.y + 20;
    return cell;
}
-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
    ElementTableViewCell * cell = (ElementTableViewCell *)[self tableView:tableView cellForRowAtIndexPath:indexPath];
    return cell.cellHeight;
}



@end
